package cn.iocoder.yudao.module.resource.dal.mysql.cosplayoperation;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.resource.controller.admin.cosplayoperation.CosplayOperationPageReqVO;
import cn.iocoder.yudao.module.resource.dal.dataobject.cosplayoperation.CosplayOperationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 角色操作 Mapper
 *
 * @author lizhongwen
 */
@Mapper
public interface CosplayOperationMapper extends BaseMapperX<CosplayOperationDO> {

    default PageResult<CosplayOperationDO> selectPage(Long userId, CosplayOperationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CosplayOperationDO>()
                .eqIfPresent(CosplayOperationDO::getUserId, userId)
                .eqIfPresent(CosplayOperationDO::getRoleId, reqVO.getRoleId())
                .eqIfPresent(CosplayOperationDO::getFavorited, reqVO.getFavorited())
                .eqIfPresent(CosplayOperationDO::getPlayed, reqVO.getPlayed())
                .eqIfPresent(CosplayOperationDO::getExtension, reqVO.getExtension())
                .betweenIfPresent(CosplayOperationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CosplayOperationDO::getId));
    }

}